﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/Admin.Master" AutoEventWireup="true"
    CodeBehind="User_Update.aspx.cs" Inherits="Ryder_US_Website.Presentation.Admin.User_Update"
    Title="Cập nhật nhân viên" %>


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script language="javascript" type="text/javascript">
    function checkChbChangePassword() {
        var chbChangePassword = document.getElementById('<%= chbMatKhau.ClientID %>');
        var txtNewPassword = document.getElementById('<%= txtMatKhau.ClientID %>');
        if (chbChangePassword.checked == false)
            txtNewPassword.value = "";
        txtNewPassword.disabled = !chbChangePassword.checked;
        document.MainForm.submit = false;
    }
    function validateForm() {
        if (document.getElementById('<%=txtTenDangNhap.ClientID %>').value == "" || document.getElementById('<%= txtTenDangNhap.ClientID %>').value.length < 1) {
            alert("Tên đăng nhập không được trống");
            document.getElementById('<%=txtTenDangNhap.ClientID %>').focus();
        }
        else if(document.getElementById('<%=chbMatKhau.ClientID %>').checked && (document.getElementById('<%=txtMatKhau.ClientID %>').value==""|| document.getElementById('<%=txtMatKhau.ClientID %>').value.length<1)){
            alert("Mật khẩu không được trống");
            document.getElementById('<%=chbMatKhau.ClientID %>').focus();
        }
        else
             return true;
        return false;
        
    }
</script>


    <h1 class="title">
        Cập nhật nhân viên</h1>
    <p>
    </p>
    <form id="MainForm" name="MainForm" action="" method="post">
    <table style="width: 91%;">
        <tr>
            <td colspan="3" class="style1">
                <p>
                </p>
            </td>
        </tr>
        <tr>
            <td style="width: 25%" class="style2">
                <asp:Label ID="lbLoaiNhanVien" runat="server" Text="lbLoaiNhanVien">Loại nhân 
                viên:</asp:Label>
            </td>
            <td style="width: 2%">
            </td>
            <td class="style1">
                <asp:RadioButton ID="rbQuanTri" runat="server" Text="Quản trị viên" Checked="True"
                    GroupName="role" Font-Size="Medium" />
                &nbsp;
                <asp:RadioButton ID="rbNhanVien" runat="server" Text="Nhân viên" GroupName="role"
                    Font-Size="Medium" />
            </td>
        </tr>
        <tr>
            <td colspan="3" class="style1">
                <p>
                </p>
            </td>
        </tr>
        <tr>
            <td class="style2">
                <asp:Label ID="Label1" runat="server" Text="lbTenDangNhap">Tên đăng nhập:</asp:Label>
            </td>
            <td class="style1">
                &nbsp;
            </td>
            <td class="style1">
                <asp:TextBox ID="txtTenDangNhap" runat="server" Width="350px" Font-Size="Medium"></asp:TextBox>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="3" class="style1">
                <p>
                </p>
            </td>
        </tr>
        <tr>
            <td class="style2">
                <asp:Label ID="lbMatKhau" runat="server" Text="lbMatKhau"> Mật khẩu:</asp:Label>
            </td>
            <td class="style1">
                &nbsp;
            </td>
            <td class="style1">
                <asp:TextBox ID="txtMatKhau" runat="server" TextMode="Password" Width="230px"
                    Font-Size="Medium" Enabled="False"></asp:TextBox>
                &nbsp;
                <asp:CheckBox ID="chbMatKhau" runat="server" Text=" Đổi mật khẩu" AutoPostBack="false"
                    Checked="false" Font-Size="Medium" OnClick="checkChbChangePassword()" />
            </td>
        </tr>
        <tr>
            <td colspan="3" class="style1">
                &nbsp;</td>
        </tr>
        <tr>
            <td colspan="2">
            </td>
            <td class="style1">
                <asp:Button ID="btnCapNhat" runat="server" Text="Cập nhật" OnClick="btnCapNhat_Click" OnClientClick="return validateForm();"
                    CssClass="button" />
                &nbsp;
                <asp:Button ID="btnHuy" runat="server" Text="Hủy" CssClass="button" 
                    PostBackUrl="/Presentation/Admin/User_List.aspx" onclick="btnHuy_Click" />
            </td>
        </tr>
    </table>
    </form>
</asp:Content>
